using System.Windows.Forms;
using OFX.Aggregator.Infrastructure;

namespace OFX.Aggregator.Application
{
	internal class ProgressBarReport : IProgressReport
	{
		private readonly ProgressBar progressBar;

		public ProgressBarReport(ProgressBar progressBar)
		{
			this.progressBar = progressBar;
		}

		#region Implementation of IProgressReport

		public void OnProgress(int currentStep, int totalSteps)
		{
			this.progressBar.Minimum = 0;
			this.progressBar.Maximum = totalSteps;
			this.progressBar.Value = currentStep;

			this.progressBar.Visible = true;
		}

		public void OnFinish()
		{
			this.progressBar.Visible = false;
		}

		#endregion
	}
}